//
//  CZMessageViewController.swift
//  GZWeibo666
//
//  Created by Apple on 16/04/22.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class CZMessageViewController: CZBaseTableViewController {

    let cellTitleArr =
    [["cellTitle":"我的相册","iconName":"album"],
        ["cellTitle":"新手任务","iconName":"draft"],
        ["cellTitle":"我的赞","iconName":"like"],
        ["cellTitle":"我的好友","iconName":"new_friend"],
        ["cellTitle":"微博支付","iconName":"pay"],
        ["cellTitle":"微博运动","iconName":"vip"],
        ["cellTitle":"我的名片","iconName":"card"],
        ["cellTitle":"更多","iconName":"collect"]]
    
    override func viewDidLoad() {
        super.viewDidLoad()

    }



    // MARK: - Table view data source

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return cellTitleArr.count
    }
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        
        let cell:UITableViewCell = UITableViewCell()
        cell.textLabel?.text = cellTitleArr[indexPath.row]["cellTitle"]
        cell.imageView?.image = UIImage(named: cellTitleArr[indexPath.row]["iconName"]!)
        
        return cell
    }

    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        print("'点击选中了cell")
    }


    override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        
        //添加headView
        let headView:UIImageView = UIImageView()
        headView.frame = CGRectMake(0, 0, UIScreen.width(), 140)
        headView.image = UIImage(named: "square_ad")
        return  headView
    }
    
    
    override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 150
    }



}
